package com.cari.oa.domain;

import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

/**
 * 系统登录日志实体类
 * User: yexuhui
 * Date: 12-12-12
 * Time: 下午9:49
 */
@Entity
@Table(name = "T_SYS_LOGIN_LOG")
public class SysLoginLogEntity implements Serializable {

    private static final long serialVersionUID = -2139096316256747736L;

    @Id
    @Length(max = 32)
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    private String id;

    @NotNull(message = "系统用户名不能为空")
    @Length(max = 32, min = 4, message = "系统用户名长度在4~32个字符之间")
    @Column(name = "user_name")
    private String userName;

    @NotNull(message = "登录类型不能为空")
    private Integer type = 1;   //登录类型（1：登入；0登出）
    
    @Length(max = 32, message = "IP长度小于32个字符")
    private String ip;

	@Column(name = "create_time")
    private Date createTime = new Date();

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getIp() {
		return ip;
	}

	public void setIp(String ip) {
		this.ip = ip;
	}
}
